package cn.iocoder.yudao.module.trade.dal.dataobject.fruitcard;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.trade.controller.admin.fruitcard.vo.FruitCardDetailExportReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.fruitcard.vo.FruitCardDetailPageReqVO;
import cn.iocoder.yudao.module.trade.controller.admin.fruitcard.vo.FruitCardDetailSummaryVO;
import cn.iocoder.yudao.module.trade.dal.mysql.fruitcard.FruitCardDetailDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

/**
 * 水果卡 Mapper
 *
 * @author 管理员
 */
@Mapper
public interface FruitCardDetailMapper extends BaseMapperX<FruitCardDetailDO> {

    default PageResult<FruitCardDetailDO> selectPage(FruitCardDetailPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<FruitCardDetailDO>()
                .eqIfPresent(FruitCardDetailDO::getFruitCardId, reqVO.getFruitCardId())
                .eqIfPresent(FruitCardDetailDO::getCardNo, reqVO.getCardNo())
                .eqIfPresent(FruitCardDetailDO::getCardPwd, reqVO.getCardPwd())
                .betweenIfPresent(FruitCardDetailDO::getActivationTime, reqVO.getActivationTime())
                .betweenIfPresent(FruitCardDetailDO::getExpiredTime, reqVO.getExpiredTime())
                .eqIfPresent(FruitCardDetailDO::getUses, reqVO.getUses())
                .eqIfPresent(FruitCardDetailDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FruitCardDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FruitCardDetailDO::getId));
    }

    default List<FruitCardDetailDO> selectList(FruitCardDetailExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<FruitCardDetailDO>()
                .eqIfPresent(FruitCardDetailDO::getFruitCardId, reqVO.getFruitCardId())
                .eqIfPresent(FruitCardDetailDO::getCardNo, reqVO.getCardNo())
                .eqIfPresent(FruitCardDetailDO::getCardPwd, reqVO.getCardPwd())
                .betweenIfPresent(FruitCardDetailDO::getActivationTime, reqVO.getActivationTime())
                .betweenIfPresent(FruitCardDetailDO::getExpiredTime, reqVO.getExpiredTime())
                .eqIfPresent(FruitCardDetailDO::getUses, reqVO.getUses())
                .eqIfPresent(FruitCardDetailDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(FruitCardDetailDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(FruitCardDetailDO::getId));
    }


    List<FruitCardDetailSummaryVO> detailSummaryByFruitCardIds(@Param("list") List<Long> fruitCardIds);

}
